package common;

import java.util.Random;

public class RandomGenerator 
{
	private RandomGenerator()
	{
		generator = new Random(TimeManager.getInstance().getTimeInMillis());
	}
	
	public int nextInt(int n)
	{
		return generator.nextInt(n);
	}
	
	public static RandomGenerator getInstance()
	{
		if (instance == null)
		{
			synchronized(RandomGenerator.class)
			{
				if (instance == null)
				{
					instance = new RandomGenerator();
				}
			}
		}
		
		return instance;
	}
	
	private static RandomGenerator instance = null;
	private Random generator;
}
